package com.wushijia.spi;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * SPI
 *
 * @author Administrator
 * @date 2021-06-03 17:24
 */
public class SPITest {

  public static void main(String[] args) {

    Class clazz = FileStoreService.class;
    ServiceLoader serviceLoader = ServiceLoader.load(clazz);
    Iterator iterator = serviceLoader.iterator();
    while (iterator.hasNext()){
      FileStoreService fileStoreService = (FileStoreService) iterator.next();
      fileStoreService.upload();
    }
  }
}
